package com.zoke.daycarpool.config;

import java.io.File;

import android.content.Context;
import android.os.Environment;

import com.zoke.support.config.ZokeConfig;
import com.zoke.support.utils.FileUtil;

/**
 * 拼车的配置信息
 * 
 * @author jack
 * 
 */
public class CarpoolConfig extends ZokeConfig {

	public static final String TESTAPP_DOWNLOADURL = "http://www.pgyer.com/daycarpool";

	public static final String HTTPURL = "http://123.57.250.156";// 服务器
	// 第三方登陆标示
	public static final String LOGINTYPE_QQ = "1";
	public static final String LOGINTYPE_SINA = "2";
	/** 路线分割符 **/
	public static final String ROADARROW = "⇌";
	/** 存储Token **/
	public static final String TOKEN = "_Token";
	/** 主页列表最后的id **/
	public static final String MAINTIMESTAMPID = "_messageId";

	/** 发送的消息 **/
	public class MessageCode {
		/** 用户主动双击tab刷新首页数据 **/
		public static final int REUPDATE_MAIN = 10;
		public static final int UPDATE_MIENFRAGMENT = 11;
	}

	/** 第三方开放平台 **/
	public class OpenPlatform {
		/** 加入QQ交流群的方法key 一键加QQ群 **/
		public static final String JOINQQGROUPKEY = "9MvNqcfgiwzhNfGagMLK8kO8mCzYNrza";
		/** 关注微博Url **/
		public static final String ACTIONWEIBOURL = "http://m.weibo.cn/users/5476394756/qq";
		/** qq第三方 **/
		public static final String QQ_APPID = "1104150679";
		public static final String QQ_APPKEY = "IYNOhz1UkH04HL9w";
		/** 新浪第三方 **/
		public static final String SINA_APPKEY = "4162960498";
	}

	/** 请求操作码 **/
	public class HttpCode {
		/** qq登陆 **/
		public static final int QQ_LOGIN = 2;
		/** sina登陆 **/
		public static final int SINA_LOGIN = 3;
		/** 编辑电话 **/
		public static final int EDIT_PHONE = 4;
		/** 编辑名字 **/
		public static final int EDIT_NAME = 5;
		/** 编辑性别 **/
		public static final int EDIT_SEX = 6;
		/** 编辑身份 **/
		public static final int EDIT_IDENTY = 7;
		/** 编辑头像 **/
		public static final int EDIT_HEAD = 8;

	}

	public static class ShareKey {
		public static final String LON = "_share_lon";
		public static final String LAT = "_share_lat";
	}

	/** 存储sd卡的地址库 **/
	public static class PathStores {
		private static final String SEPARATOR = File.separator;
		// 拼车根目录
		private static final String CARPOOLPATH = SEPARATOR + ".carpool";
		private static final String CARPOOLCACHE = CARPOOLPATH + SEPARATOR
				+ ".cache";

		/** 获取临时缓存文件目录 **/
		public static String getCachePath(Context context) {
			return getSDCardOrAvailable(context) + CARPOOLCACHE
					+ File.separator;
		}

		/** 获取拼车根目录 **/
		public static String getCarpoolDir(Context context) {
			return getSDCardOrAvailable(context) + CARPOOLPATH + File.separator;
		}

		/** 获取sd卡根目录 **/
		public static String getSDCardOrAvailable(Context context) {
			if (FileUtil.isSdcardExist()) {
				return Environment.getExternalStorageDirectory().toString();
			} else {
				return context.getFilesDir().toString();
			}
		}

	}

}
